from coffeetalk.protocol import ioelement

class Connection(object):
    
    def __init__(self,name=None,username='',password='',group='',userclass='Users',host='',port='0'):
        self.name = name
        self.username = username
        self.password = password
        self.group = group
        self.userclass = userclass
        self.host = host
        self.port = int(port)
        
    def __str__(self):
        return str(self._to_element())
    def _to_element(self):
        return ioelement.IOElement(self.name,{'type':'[Connection]','username':self.username,'password':self.password,'group':self.group,'userclass':self.userclass,'host':self.host,'port':str(self.port)})
